<?php

use yii\helpers\Html;
use eric\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\FrontUser */
/* @var $form eric\widgets\ActiveForm */
?>
<div class="front-user-form">

    <?php $form = ActiveForm::begin([
        'ajaxSubmitSuccess' => "function(data){\$('#front_user_modal').modal('hide');\$.pjax.reload('#front_user_grid_pjax');}",
        'options' => [
            'id' => 'front-user_form',
            'class' => 'form-horizontal form-bordered',
        ]
    ]); ?>

    <?= $form->field($model, 'username')->textInput(['maxlength' => 64]) ?>

    <?
    if($model->isNewRecord){
        echo $form->field($model, 'password')->passwordInput(['maxlength' => 32]);
    }else{
        echo $form->field($model, 'password2')->passwordInput(['maxlength' => 32]);
    }

    ?>

    <?= $form->field($model, 'mobile')->textInput(['maxlength' => 32]) ?>
    <?php if(!isset($model->status))$model->status = 1;?>
    <?= $form->field($model, 'status')->radioList([1=>'正常使用',0=>'停用']) ?>

    <?= $form->field($model, 'email')->textInput(['maxlength' => 128]) ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? Yii::t('app', '添加') : Yii::t('app', '修改'), ['class' => $model->isNewRecord ? 'btn btn-support1' : 'btn btn-support3']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
